#ifndef WINDOW_H
#define WINDOW_H

#include "SDL/SDL.h"
#include "SDL/SDL_opengl.h"
#include "Image.h"
#include <string>

typedef unsigned short uint16;

namespace fe
{
    class Window
    {
    public:
        Window(uint16 w, uint16 h, uint16 bpp, std::string title, bool fullscreen = false);
        ~Window();

        void initGL();

        inline void clear() {
            glClear(GL_COLOR_BUFFER_BIT);

            glLoadIdentity();
            glClearColor(0.f, 0.f, 0.f, 0.f);

            glEnableClientState(GL_VERTEX_ARRAY);
            glEnableClientState(GL_TEXTURE_COORD_ARRAY);
        }
        inline void display(){
            glDisableClientState(GL_VERTEX_ARRAY);
            glDisableClientState(GL_TEXTURE_COORD_ARRAY);
            SDL_GL_SwapBuffers();
        }


        inline bool isOpen() const { return m_open; }

        uint16 getHeight() const { return m_height; }
        uint16 getWidth()  const { return m_width;  }

        void setSize(uint16 w, uint16 h);
        void close();

    private:

        SDL_Surface* m_screen;

        uint16 m_width, m_height, m_bpp;

        std::string m_title;

        bool m_fullscreen;
        bool m_open;

    };

}
#endif // WINDOW_H

